package com.atguigu.exceptionhandls;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionHeader {
    @ExceptionHandler(NullPointerException.class)
    public String nullException(){
        System.out.println("null exception");
        return " null exception!!!";
    }
    @ExceptionHandler(Exception.class)
    public String exception(Exception e){
       e.printStackTrace();
       return e.getMessage();
    }
}
